<?php session_start();
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use

// if session is not set redirect the user
if(empty($_SESSION['u_name']))
	header("Location:index.php");	

//if logout then destroy the session and redirect the user
if(isset($_GET['logout']))
{
	session_destroy();
	header("Location:index.php?logout=true");
}
include 'conn/conn.php';

//$run = mysql_query($sql);
//while($data = mysql_fetch_array($run))
	//{
//$content = htmlspecialchars_decode(stripslashes($data['location']));
//}


$arrImagePath = array();



$sqlImgeForSlideshow = "SELECT * FROM tbl_showcase_slideshow";
$run = mysql_query($sqlImgeForSlideshow);
$count=0;
while($data=mysql_fetch_array($run))
{
	$arrImagePath[$count]['image_path'] =  $data['image_path'];
	$arrImagePath[$count]['id'] =  $data['id'];
	$count++;
}
?>
<?php
$path = "http://".$_SERVER["HTTP_HOST"]."/gibbons";
?>
<?php
include 'includes/header.php';
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0" >
<tr>
<td colspan="2">
<?php
$str = "<a href='home.php?logout' style='text-align:right;'><b>Logout<b></a>";
echo "<div align='right'>Welcome ".$_SESSION['name'].", ".$str."</div>";
?>
</td>
</tr>
<tr>
<td width="15%" valign="top">
<?php
include 'includes/menu.php';
?>
</td>
<td valign="top">
<div id="tabs">
<form>
	<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-left: 30px;">
			<h2><font color="#66FF00"><center>Edit Showcase Banner</center></font></h2>
			<tr>
				<td>
					<!-- TEMP<ORARY MESSAGE BOX -->
			<style type="text/css">
			.clean-gray
			{
				border:solid 1px #77776E;
				background:#FFFFCC;
				color:#222222;
				padding:4px;
				text-align:center;
				font-family: Verdana,Arial;
				font-size: 11px;
				font-weight: normal;
				padding: 5px 5px 5px 5px;
				text-align: left; 
				width:800px;
			}
		.btnClass {
		position:relative;
		top:0 px;
		background-color: transparent;
		background-image: url(../images/buttonBackground.gif);
		background-repeat: no-repeat;
		width: 134px;
		height: 30px;
		margin: -2px auto;
		padding: -2px 0 0 0;
		text-align: center;
		font-family: Helvetica, Calibri, Arial, sans-serif;
		font-size: 100%;
		font-weight: bold;
		text-decoration: none;
		border:0px;
		cursor:pointer;
		}
			</style>
			<div class="clean-gray">
			<b>Upload Your Banners (sized 648px by 290px at 72 resolution). The Uploaded banner will be displayed in your home page.</b>
			</div>
			<div style="height: 20px;">&nbsp;</div>
			<!-- TEMPORARY MESSAGE BOX ENDS-->
				</td>
			</tr>
			<tr>
				<td>
					<div id="divImageUploader" name="divImageUploader">
						<table>
			<tr>
			<td>
			<div id="universalUploader_holder" style="70%">
			<link rel="stylesheet" href="../universal/style.css">
			<link rel="stylesheet" href="../universal/styles.css">
			<!-- UniversalUploader JavaScript code file -->
			<script type="text/javascript" src="../universal/universalUploader.js"></script>
			<noscript>	
			<form id="frmVehicle" name="frmVehicle" action="url to file processing script"  method="post" enctype="multipart/form-data">		
			
			<input name="Filedata" type="file"><br>
			<input type="submit" value="Upload" />		
			</form>
			 </noscript>
			 
			
			 
			</div>
			<!-- Initialization of UniversalUploader object -->	
			<script type="text/javascript">
			universalUploader.init({
				//Your serialNumber
				serialNumber: "put your license key here",
				//List of uploaders to render
				uploaders: "drag-and-drop, flash, silverlight, classic",
				//Fir of correctly initialized uploader will be rendered
				singleUploader : true,
				//Id of html element where universalUploader should be rendered
				//If not set, document body used  
				holder: "universalUploader_holder",
				//Url to the swf file
				flash_swfUrl : "../ElementITMultiPowUpload.swf",
				//Url to the xap file
				silverlight_xapUrl : "../universal/uploaders/UltimateUploader.xap",
				//Path to the folder with images (status icons, remove icon) By default images subfolder is used (relative to the html page base path)
				//In these examples we place icons inside universal/images subfolder. 
				imagesPath : "../universal/images/",	
				//Url to the file processing script 
				url: "../upload-homepage-banners1.php",
				//Set id of html for element to pass it's values to the server script along with files
				formName: "frmVehicle",
				//Custom post fields can be configured manually
				postFields :{
						
				}
			});
			
			//File upload complete
			universalUploader.bindEventListener("FileUploadComplete", function (uploaderId, file){	
				var responselable = document.getElementById("serverresponse");		
				if(file.serverResponse) responselable.innerHTML += "<strong>" + file.serverResponse + "</strong>";	
				
			});	
			
			//File upload error handler
			universalUploader.bindEventListener("FileUploadError", function (uploaderId, file, status, msg){
				var responselable = document.getElementById("serverresponse");		
				responselable.innerHTML += "File Upload error "+file.name+" status "+status+" message "+msg;
			});
			
			
			universalUploader.bindEventListener("Init", function (inited){
					if(!inited)			
						alert("UniversalUploader failed to init!");
			});
			
			</script>
						
			<div id="serverresponse"></div><br />
			</td>
			</tr>
			</table>
					</div>
				</td>
			</tr>
			
			<tr>
				<td>
					<div style="height: 15px;">&nbsp;</div>
					<div class="clean-gray">
						<b>Preview button and see the preview! </b>
						<div style="height: 15px;">&nbsp;</div>
						<a class='example7' href="preview-homepage-data.php">Preview Home Page Banner</a>
					</div>
				</td>
			</tr>
			
			<tr>
				<td>
					<div style="height: 15px;">&nbsp;</div>
					<div class="clean-gray">
						<table cellpadding="10" cellspacing="3" border="0" >
							<tr>
								<td colspan="2"><h4 style="margin:0">Uploaded Images</h4></td>
							</tr>
							<?php 
						  	if(count($arrImagePath)>0)
						  	{
						  		foreach($arrImagePath as $imgPath)
						  		{
						  			?>
						  				<tr style="border-bottom: 1px dotted #CDCDCD;">
						  					<td valign="middle">
						  						<img src="<?php echo $imgPath['image_path']; ?>" width="150" height="65" border="1" alt="" />
						  					</td>
						  					<td valign="middle" align="right">
						  						<a style="cursor:pointer;" onclick="DeleteImageFromSlideShow1('<?php echo $imgPath['id']; ?>')" title="Clicking on that the image will not show up in the showcase slideshow">Delete This Image From Slideshow</a>
						  					</td>
						  				</tr>
						  				
						  			<?php 
						  		}
						  	}
						  	?>
						</table>
					</div>
				</td>
			</tr>
	</table>
	<link media="screen" rel="stylesheet" href="../css/colorbox.css" />
	<script src="../js/jquery.colorbox.js"></script>
	<script>
		
		function onloadcall(){
			//Examples of how to assign the ColorBox event to elements
			$(".example7").colorbox({width:"905px", height:"500px", iframe:true});
		}
		onloadcall();

		function DeleteImageFromSlideShow1(id)
		{
			if(confirm("Do You want to delete this image from Showcase slideshow ?"))
			{
				$.post("admin-back-saving.php",{action:"image_slide_delete_showcase",id:id},function(data){
					if(data==1)
					{
						window.location.reload();
					}
				},"text");
			}
		}
		
	</script>
	
</form>




</div>
</td>
</tr>
</table>
<?php
include 'includes/footer.php';
?>

